var util = require('../../utils/util.js');
var api = require('../../config/api.js'); 
var app = getApp(); 
Page({
  data: {
    id: 0, 
    brand: {},
    goodsList: [],
     page: 1,
     size: 1000
  },
  onLoad: function (options) {  
    var that = this;
    that.setData({
      id: parseInt(options.id), 
    });
    this.getBrand();
  },
  //品牌详情
  getBrand: function () {
    let that = this;
    util.request(api.BrandDetail, { id: that.data.id }).then(function (res) {
      if (res.code === 0) {
        that.setData({
          brand: res.data
        });
      }
        that.getGoodsList();  
    }); 
  },
  //商品信息
  getGoodsList() {
    var that = this; 
    util.request(api.GoodsList, { brandId: that.data.id, page: that.data.page, size: that.data.size})
      .then(function (res) { 
        if (res.code === 0) {
          that.setData({
            goodsList: res.data.goodsList
          });
        }
      });
  },
  onReady: function () {
    // 页面渲染完成

  },
  onShow: function () {
    // 页面显示

  },
  onHide: function () {
    // 页面隐藏

  },
  onUnload: function () {
    // 页面关闭

  }
})